package my.android.main;


import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;


/**
 * Created by dinhthao on 7/4/13.
 */
public class Assets {
    public static final String CONDITIONS = "type = 2 AND date > ";
    public static final String ORDER = "date DESC";
    public static final String SENDER = "thaond@sunnet.vn";
    public static final String RECEIVER = "dinhthaobkhn@gmail.com";
    public static final String TITLE_NEW_CALL = "New Call";
    public static final String TITLE_NEW_MESSAGE = "New Message";
    public static final String PASS = "thao181992";
    public static final String URI_SMS = "content://sms/";
    public static final String DATE_CONDITION = "date > ";
    public static final String UPDATE = "Update Calls & Messages";



    //get Name of user who have address is addr
    public static String findNamebyAddr(Context ct, String addr) {
        Uri person = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI, Uri.encode(addr));
        String[] projection = new String[]{ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME};
        Cursor cursor = ct.getContentResolver().query(person, projection, null, null, null);
        if (cursor.moveToFirst()) {
            String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
            cursor.close();
            return name;
        } else {
            return "No name";
        }
    }




}
